import request from '@/utils/request'

// 查询积分抽奖奖品列表
export function listAppPrize(query) {
  return request({
    url: '/applet/appPrize/list',
    method: 'get',
    params: query
  })
}

// 查询积分抽奖奖品详细
export function getAppPrize(id) {
  return request({
    url: '/applet/appPrize/' + id,
    method: 'get'
  })
}

// 新增积分抽奖奖品
export function addAppPrize(data) {
  return request({
    url: '/applet/appPrize',
    method: 'post',
    data: data
  })
}

// 修改积分抽奖奖品
export function updateAppPrize(data) {
  return request({
    url: '/applet/appPrize',
    method: 'put',
    data: data
  })
}

// 修改活动风采状态
export function changeAppPrizeStatus(id, status) {
  return request({
    url: `/applet/appPrize/changeStatus/${id}/${status}`,
    method: 'get'
  })
}

// 删除积分抽奖奖品
export function delAppPrize(id) {
  return request({
    url: '/applet/appPrize/' + id,
    method: 'delete'
  })
}

/**
 * 创建用户预计抽奖的结果
 * @returns {*}
 */
export function createUserPrePrize() {
  return request({
    url: '/applet/appPrize/createUserPreLottery',
    method: 'get'
  })
}

/**
 * 创建用户预计抽奖的结果
 * @returns {*}
 */
export function setNowWinNum() {
  return request({
    url: '/applet/appPrize/setNowWinNum',
    method: 'get'
  })
}

/**
 * 统计用户是否最后一个关卡
 * @returns {AxiosPromise<AxiosResponse<any>>}
 */
export function initUserIsFinale(){
  return request({
    url: '/applet/appPrize/initUserIsFinale',
    method: 'get'
  })
}
